/*
 * $Id$
 *
 * Copyright (C) 2008 Josh Guilfoyle <jasta@devtcg.org>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2, or (at your option) any
 * later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 */

package org.devtcg.five.music.service;

interface IPlaylistBufferListener
{
	/**
	 * Notifies the listener as the song downloads.  Note that
	 * {@link onStreamStart} may be encountered prior to
	 * <code>bufferPercent</code> reaching 100 as a result of optimistic
	 * streaming.  That is, if the buffer fills at an unusually high
	 * rate, the stream may begin early.
	 *
	 * @param songId
	 * 
	 * @param percent
	 *   Total percentage complete.
	 *
	 * @param bufferPercent
	 *   Buffer fill percentage.
	 */
	void onBufferUpdate(long songId, int percent, int bufferPercent);

	/**
	 * Indicates that the song is now streaming.  That is, playback has begun.
	 */
	void onStreamStart(long songId);

	/**
	 * Indicates that the song has paused, pending additional data from the
	 * server.  This might not be a transitory condition, for example if the
	 * user has gone outside of cell range or has disabled the radio.
	 */
	void onStreamChoke(long songId);
}
